package cn.com.interstore.bg.dom.org;

import java.util.List;

import org.nakedobjects.applib.AbstractFactoryAndRepository;
import org.nakedobjects.applib.Filter;
import org.nakedobjects.applib.annotation.Exploration;
import org.nakedobjects.applib.annotation.MemberOrder;

public class ShippingMethodRepository extends AbstractFactoryAndRepository {
	// {{ Create new (still transient) ShippingMethod
	public ShippingMethod newShippingMethod() {
		ShippingMethod shippingMethod = newTransientInstance(ShippingMethod.class);
		// TODO: set up any properties

		return shippingMethod;
	}

	// }}

	// {{ all ShippingMethod
	@Exploration
	public List<ShippingMethod> allShippingMethod() {
		return allInstances(ShippingMethod.class);
	}

	// }}

	// {{ findByName
	@MemberOrder(sequence = "1")
	public List<ShippingMethod> findByName(final String name) {
		return this.allMatches(ShippingMethod.class,
				new Filter<ShippingMethod>() {
					public boolean accept(final ShippingMethod shippingMethod) {
						return shippingMethod.getName().equals(name);
					}
				});

	}

}
